package pms.sg.action;

import com.opensymphony.xwork2.ActionSupport;
import java.io.IOException;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.*;

import pms.sg.service.DetailSGService;
import pms.common.value.sgListValue;

public class DetailSGAction extends ActionSupport{
	
	private static final long serialVersionUID = 1L;
	private sgListValue zhList;
	private DetailSGService detailSGService;
	private List<HashMap> monthList;
	private List<HashMap> dayList;
	private String no;
	private int currentStatus;
	
	public int getCurrentStatus() {
		return currentStatus;
	}
	public void setCurrentStatus(int currentStatus) {
		this.currentStatus = currentStatus;
	}
	public sgListValue getZhList() {
		return zhList;
	}
	public void setZhList(sgListValue zhList) {
		this.zhList = zhList;
	}
	public List<HashMap> getDayList() {
		return dayList;
	}
	public void setDayList(List<HashMap> dayList) {
		this.dayList = dayList;
	}
	public sgListValue getzhList() {
		return zhList;
	}
	public void setzhList(sgListValue zhList) {
		this.zhList = zhList;
	}

	public DetailSGService getDetailSGService() {
		return detailSGService;
	}
	public void setDetailSGService(DetailSGService detailSGService) {
		this.detailSGService = detailSGService;
	}
	public List<HashMap> getMonthList() {
		return monthList;
	}
	public void setMonthList(List<HashMap> monthList) {
		this.monthList = monthList;
	}
	public String getNo() {
		return no;
	}
	public void setNo(String no) {
		this.no = no;
	}
	
	
	@SuppressWarnings("unchecked")
	public List getMonthArray() {
		return detailSGService.getMonthArray();
	}
	
	@SuppressWarnings("unchecked")
	public List getDayArray() {
		return detailSGService.getDayArray();
	}
	
	// ステータス
	@SuppressWarnings("unchecked")
	public List<HashMap> getStatusArray() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
		return detailSGService.getStatusArray();
	}
	
	// 修正担当側
	@SuppressWarnings("unchecked")
	public List<HashMap> getModifypartArray() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
		return detailSGService.getModifypartArray();
	}
	
	// 修正担当
	@SuppressWarnings("unchecked")
	public List<HashMap> getModifyArray() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {   
        return detailSGService.getUserArray();
    }
	
	// 障害要因
	@SuppressWarnings("unchecked")
	public List<HashMap> getReasonArray() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {   
        return detailSGService.getReasonArray();
    }
	
	public void setzhListData() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
		zhList = new sgListValue();
		zhList = detailSGService.setzhListData(no);
		currentStatus=detailSGService.getCurrentStatus();
	}
	
	public String modify() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
		
		detailSGService.updateListdetailData(zhList);
		return SUCCESS;
	}
	
	public String execute() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, ParseException {
		
		System.out.println("no:"+no);
		setzhListData();

		return SUCCESS;
	}
}
